package demo3;

import java.util.Arrays;
import java.util.Scanner;

class Set {
    private String[] str = new String[10];
    private int useSize;

    public String[] getStr() {
        return str;
    }

    public void add(String s) {
        if(isfull(this.str)) {
            grow();
        }
        str[this.useSize] = s;
        useSize++;
    }

    public boolean isfull(String[] str) {
        return this.useSize == str.length;
    }

    public void grow() {
        this.str = Arrays.copyOf(this.str,2*this.str.length);

    }

    public void display() {
        System.out.println();
        for (int i = 0;i < this.useSize;i++) {
            if(this.str[i].length() > 0) {
                if(i > 0 && this.str[i].equals(this.str[i-1]) || this.str[i].equals("end")) {
                    continue;
                }else {
                    System.out.println(this.str[i]);
                }
            }
        }
    }

    public void MyArrays(String[] str) {
        for (int i = 0;i < this.useSize-1;i++) {
            for (int j = 0; j < this.useSize-1-i; j++) {
                if((this.str[j].compareTo(this.str[j+1])) > 0) {
                    String tmp = this.str[j];
                    this.str[j] = this.str[j+1];
                    this.str[j+1] = tmp;
                }
            }
        }
    }

}
public class Main {
    public static void main(String[] args) {
        Set set = new Set();

        Scanner scanner = new Scanner(System.in);
        while(true) {
            String s = scanner.nextLine();
            set.add(s);
            if(s.equals("end")) {
                break;
            }
        }
        set.MyArrays(set.getStr());
        set.display();
    }
}
